import unittest


class Solution:
    def makeFancyString(self, s: str) -> str:
        cnt = 1
        ret = ""
        for ch in s:
            if not ret:
                ret += ch
                continue
            if ch != ret[-1]:
                ret += ch
                cnt = 1
                continue
            if ch == ret[-1]:
                if cnt == 2:
                    continue
                else:
                    ret += ch
                    cnt += 1
        return ret

class Test(unittest.TestCase):
    def test_case1(self):
        ret = Solution().makeFancyString("leeetcode")
        self.assertEqual("leetcode", ret)